/**
 * Created by Administrator on 2018/11/3.
 */
const Company = require("../models/companies");
/**
 * 增加公司信息
 */

module.exports = function (data, req, response) {

  Company.find(function (err, res) {
    if (err) {
      console.log("Error:" + err);
    }
  }).then(function (err, res) {
    const company = new Company({
      name: data.name,
      type: data.type,
      jobs: data.jobs,
      address: data.address,
      basicInfo: data.basicInfo
    });

    company.save(function (err, res) {
      if (err) {
        response.json({
          status: 1,
          data: {
            msg: '保存错误！请重试！'
          }
        });
      } else {
        response.json({
          status: 0,
          data: {
            msg: '保存成功！'
          }
        })
      }
    })
  });

}
